/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf.views;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Version;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dchapman
 */
@Entity
@Table(name = "Supplies")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SupplyInventoryView.findAll", query = "SELECT s FROM SupplyInventoryView s ORDER BY s.supName ASC"),
    @NamedQuery(name = "SupplyInventoryView.findBySupWH", query = "SELECT s FROM SupplyInventoryView s WHERE s.supWH = ?1 ORDER BY s.supName ASC")})
public class SupplyInventoryView implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "SupID")
    private Integer supID;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 100)
    @Column(name = "SupName")
    private String supName;
    @Basic(optional = false)
    @NotNull
    @Column(name = "SupSpoken")
    private float supSpoken;
    @Basic(optional = false)
    @NotNull
    @Column(name = "SupOnHand")
    private float supOnHand;
    @Basic(optional = false)
    @NotNull
    @Column(name = "SupWH")
    private int supWH;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 50)
    @Column(name = "SupUnits")
    private String supUnits;
    @Basic(optional = false)
    @NotNull
    @Column(name = "SupOnOrder")
    private float supOnOrder;
    @Basic(optional = false)
    @NotNull
    @Column(name = "version")
    @Version
    private int version;

    public SupplyInventoryView() {
    }

    public SupplyInventoryView(Integer supID) {
        this.supID = supID;
    }

    public SupplyInventoryView(Integer supID, String supName, float supSpoken, float supOnHand, int supWH, String supUnits, float supOnOrder) {
        this.supID = supID;
        this.supName = supName;
        this.supSpoken = supSpoken;
        this.supOnHand = supOnHand;
        this.supWH = supWH;
        this.supUnits = supUnits;
        this.supOnOrder = supOnOrder;
    }

    public Integer getSupID() {
        return supID;
    }

    public void setSupID(Integer supID) {
        this.supID = supID;
    }

    public String getSupName() {
        return supName;
    }

    public void setSupName(String supName) {
        this.supName = supName;
    }

    public float getSupSpoken() {
        return supSpoken;
    }

    public void setSupSpoken(float supSpoken) {
        this.supSpoken = supSpoken;
    }

    public float getSupOnHand() {
        return supOnHand;
    }

    public void setSupOnHand(float supOnHand) {
        this.supOnHand = supOnHand;
    }

    public int getSupWH() {
        return supWH;
    }

    public void setSupWH(int supWH) {
        this.supWH = supWH;
    }

    public String getSupUnits() {
        return supUnits;
    }

    public void setSupUnits(String supUnits) {
        this.supUnits = supUnits;
    }

    public float getSupOnOrder() {
        return supOnOrder;
    }

    public void setSupOnOrder(float supOnOrder) {
        this.supOnOrder = supOnOrder;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (supID != null ? supID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SupplyInventoryView)) {
            return false;
        }
        SupplyInventoryView other = (SupplyInventoryView) object;
        if ((this.supID == null && other.supID != null) || (this.supID != null && !this.supID.equals(other.supID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.SupplyInventoryView[ supID=" + supID + " ]";
    }
    
    public String getDisplay(){
        return Integer.toString(this.supID) + " - " + this.supName;
    }
}
